<?php

namespace app\admin\controller\money;

use app\common\controller\Backend;
use think\Db;
/**
 * 提现记录
 *
 * @icon fa fa-circle-o
 */
class Tixian extends Backend
{

    /**
     * Tixian模型对象
     * @var \app\admin\model\money\Tixian
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\admin\model\money\Tixian;
        $this->view->assign("statusList", $this->model->getStatusList());
    }


    public function txbohui($ids = null)
    {
        if (false === $this->request->isPost()) {
            $this->error(__("Invalid parameters"));
        }
        $ids = $ids ?: $this->request->post("ids");

        if ($ids) {

            $info= $this->model->get($ids);

            $info= $info->toArray();


            moneyadd($info['user_id'], $info['money'], '提现驳回');


            Db::name('user_money_tx')->where('id',$ids)->delete();

            $this->success('操作成功');


        }



    }

    /**
     * 操作成功
     */
    public function txsuccess()
    {

        $ids= $this->request->param('ids');

        Db::name('user_money_tx')
            ->where('id',$ids)
            ->update(['status'=>1]);

        $this->success('操作成功');



    }


}
